package com.weishi.user.service;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.weishi.user.mapper.IUserDao;
import com.weishi.user.pojo.User;
import com.weishi.user.service.IUserService;

@Service
public class UserServiceImpl implements IUserService {
		@Autowired 
	    private IUserDao userDao;

		public User getUserById(int userId) {
			return this.userDao.selectByPrimaryKey(userId);
		}

		public int deleteByPrimaryKey(Integer id) {
			return this.userDao.deleteByPrimaryKey(id);
		}

		public int insert(User record) {
			int result = this.userDao.insert(record);
			record.setId(33);
			record.setUserName("admin");
			int a  = this.userDao.updateByPrimaryKey(record);
			return result;
		}

		@Override
		public int insertSelective(User record) {
			return this.insertSelective(record);
		}

		@Override
		public User selectByPrimaryKey(Integer id) {
			return this.userDao.selectByPrimaryKey(id);
		}

		@Override
		public int updateByPrimaryKeySelective(User record) {
			return this.userDao.updateByPrimaryKeySelective(record);
		}

		@Override
		public int updateByPrimaryKey(User record) {
			return this.userDao.updateByPrimaryKey(record);
		}

		public User selectByUNameAndPassword(User user) {
			
			return this.userDao.selectByUNameAndPassword(user);
		}  
	     
	
}
